<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt"  prefix="fmt"%>
<!DOCTYPE HTML>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Studio工作室项目管理</title>
    <link href="${pageContext.request.contextPath }/dist/css/bootstrap.min.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath }/dist/css/font-awesome.min.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath }/dist/css/nprogress.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath }/dist/css/green.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath }/dist/css/bootstrap-progressbar-3.3.4.min.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath }/dist/css/jqvmap.min.css" rel="stylesheet"/>  
    <link href="${pageContext.request.contextPath }/dist/css/daterangepicker.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath }/dist/css/custom.min.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath }/dist/css/bootstrap-datetimepicker.min.css" rel="stylesheet" media="screen">
	<script src="${pageContext.request.contextPath }/dist/js/jquery.min.js"></script>
    <script src="${pageContext.request.contextPath }/dist/js/bootstrap.min.js"></script>
	<script src="${pageContext.request.contextPath }/dist/js/custom.min.js"></script>
	<script type="text/javascript" src="${pageContext.request.contextPath }/dist/js/bootstrap-datetimepicker.js" charset="UTF-8"></script>
	<script type="text/javascript" src="${pageContext.request.contextPath }/dist/js/bootstrap-datetimepicker.fr.js" charset="UTF-8"></script>
    <style>
    html,body{overflow:hidden;overflow-y:auto;}
    #con{
        height:650px;;
        margin:50px 0 0 300px;
    }
    </style>
    <script type="text/javascript"> 
   function del() {
	var msg = "您真的确定要删除吗？\n\n请确认！";
	if (confirm(msg)==true){
	    return true;
	}else
	{
	   return false;
	}
   }
   
   function deleteWorkGroup()
   {
	   var msg = "您真的确定要删除吗？\n\n请确认！";
		if (confirm(msg)==true){
			 document.getElementById("itemForm").action="${pageContext.request.contextPath }/workGroup/deleteWorkGroups" ;
		      document.getElementById("itemForm").submit();  
		 }
	  
         
   }
   function addWorkGroup()
   {
	   document.getElementById("itemForm").action="${pageContext.request.contextPath }/workGroup/addWorkGroup" ;
	   document.getElementById("itemForm").submit();  
   }
   
</script> 

</head>
 <body class="nav-md">
    <div class="container body">
      <div class="main_container">
        <div class="col-md-3 left_col">
          <div class="left_col scroll-view">
            <div class="navbar nav_title" style="border: 0;">
              <a href="index.html" class="site_title"><i class="glyphicon glyphicon-flag"></i><span>Studio工作室</span></a>
            </div>
            <div class="clearfix"></div>
            
            <div class="profile clearfix">
              <div class="profile_pic">
                <img src="${pageContext.request.contextPath }/images/img.jpg" alt="..." class="img-circle profile_img">
              </div>
              <div class="profile_info">
                <span>Welcome,</span>
                <h2>John Doe</h2>
              </div>
            </div> <br>

            <!-- sidebar menu -->
            <div id="sidebar-menu" class="main_menu_side hidden-print main_menu">
              
              <div class="menu_section">
                <h3>Live On</h3>
                <ul class="nav side-menu">
                  <li class="active"><a href="${pageContext.request.contextPath }/clazz/clazz"><i class="glyphicon glyphicon-home"></i>班级信息管理</a></li>
                  <li><a href="${pageContext.request.contextPath }/college/college"><i class="glyphicon glyphicon-home"></i> 学院信息管理</a></li>
                  <li><a href="${pageContext.request.contextPath }/student/student"><i class="glyphicon glyphicon-home"></i> 学生信息管理</a></li>
                  <li><a href="${pageContext.request.contextPath }/workGroup/workGroup"><i class="glyphicon glyphicon-home"></i> 项目信息管理</a></li>           
                </ul>
              </div>
              
            </div>

            
          </div>
        </div> <!--左边-->
        <div class="top_nav">
          <div class="nav_menu">
            <nav>
              <div class="nav toggle">
              <a id="menu_toggle"><i class="glyphicon glyphicon-align-justify"></i></a></div>
              <ul class="nav navbar-nav navbar-right">
                <li class="dropdown">
                  <a href="#" class="user-profile dropdown-toggle" data-toggle="dropdown">
                    <img src="${pageContext.request.contextPath }/images/img.jpg">John Doe
                    <span class="glyphicon glyphicon-chevron-down"></span>
                  </a>
                </li>
              </ul>
            </nav>
          </div>
        </div><!-- 顶部导航条 -->

        <!-- page content -->
        <div class="right_col" role="main">
            <h3 class="text-center">工作室管理项目</h3>
    			   <div class="input-group col-md-3">
                  <input type="text" class="form-control col-sm-6 " placeholder="请输入关键字搜索">
              <span class="input-group-addon btn-primary"><span class="glyphicon glyphicon-search"></span></span>
            </div>
            <br>
        </div>
          <!-- /top tiles -->
          <div class="row">
            <div class="col-md-12 col-sm-12 col-xs-12">
              <div class="dashboard_graph">
                <div class="row x_title">
                  <div class="col-md-offset-2">
                    <div class="container" id="con">
        <div class="row row-centered">
            <div class="well col-md-7 col-centered">
               <h3 class="header-title">项目信息列表</h3>
            <div class="btn-toolbar">
                <div class="btn-group">
                        <input type="button"  value="删除所选项" onclick="deleteWorkGroup()" class="btn btn-warning" />
                </div>
                <div class="btn-group">
                    <input type="button"  value="新增项目"   onclick="addWorkGroup()" class="btn btn-info" />
                </div>
            </div>
            
							<form id="itemForm" action="${pageContext.request.contextPath }/workGroup/addWorkGroup.action" method="post">
								<table class="table table-bordered table-hover" id="tablehover">
								<tr class="success">
									<td>选择</td>
									<td>项目编号</td>
									<td>项目名称</td>
									<td>负责人</td>
								</tr>
								<c:forEach items="${workGroupList}" var="item">
								<tr>	
									<td><input type="checkbox" name="id" value="${item.groupId}"/></td>
									<td>${item.groupId }</td>
									<td>${item.groupName}</td>
									<td>${item.headerId }</td>
									<td class="col-sm-1 text-center"><a href="${pageContext.request.contextPath }/workGroup/editWorkGroup.action?id=${item.groupId}" class="btn btn-primary"><i class="glyphicon glyphicon-edit"></i></a></td>
									<td class="col-sm-1 text-center"><a href="${pageContext.request.contextPath }/workGroup/deleteWorkGroup.action?id=${item.groupId}" onclick="javascript:return del();" class="btn btn-danger"><i class="glyphicon glyphicon-trash"></i></a></td> 
								</tr>
								</c:forEach>
								</table>
							</form>

				<!-- 分页 -->
<ul class="pagination" style="margin-left:200px;">
             <div class="divBody">  
  <div class="divContent">
   
    <%--上一页 --%> 
 
<c:choose>  
    <c:when test="${page.pageNum eq 1 }"><span class="spanBtnDisabled">上一页</span></c:when>  
    <c:otherwise><a href="javascript:void(0)" onclick="SetRequest(${page.pageNum-1})" class="aBtn bold">上一页</a></c:otherwise>  
</c:choose>
               <c:choose>  
    <c:when test="${page.tp <= 6 }">  
        <c:set var="begin" value="1"/>  
        <c:set var="end" value="${page.tp }"/>  
    </c:when>  
    <c:otherwise>  
        <c:set var="begin" value="${page.pageNum-2 }"/>  
        <c:set var="end" value="${page.pageNum + 3}"/>  
        <c:if test="${begin < 1 }">  
          <c:set var="begin" value="1"/>  
          <c:set var="end" value="6"/>  
        </c:if>  
        <c:if test="${end > page.tp }">  
          <c:set var="begin" value="${page.tp-5 }"/>  
          <c:set var="end" value="${page.tp }"/>  
        </c:if>         
    </c:otherwise>  
 </c:choose>  

<c:forEach begin="${begin }" end="${end }" var="i">  
   <c:choose>  
      <c:when test="${i eq page.pageNum }">  
        <span class="spanBtnSelect">${i }</span>  
      </c:when>  
      <c:otherwise>  
        <a href="javascript:void(0)" onclick="SetRequest(${i })" class="aBtn">${i }</a>  
      </c:otherwise>  
   </c:choose>
   </c:forEach>
   
   <c:if test="${end < page.tp }">  
      <span class="spanApostrophe">...</span>  
    </c:if>
    
    <c:choose>  
    <c:when test="${page.pageNum eq page.tp }"><span class="spanBtnDisabled">下一页</span></c:when>  
    <c:otherwise><a href="javascript:void(0)"  onclick="SetRequest(${page.pageNum+1})" class="aBtn bold">下一页</a></c:otherwise>  
</c:choose>

<span>共${page.tp }页</span>
<!-- 分页 -->

            </div>
        </div>
    </div>

    <!--模态框
    -->
    
                  </div>
                  
              </div>
            </div>
          </div>
        
        <!-- footer content -->
        <footer>
          <div class="pull-right"> Studio - Bootstrap Admin Template by <a href="#">Colorlib</a></div>
          <div class="clearfix"></div>
        </footer> 
      </div>
   </div>
    <script type="text/javascript">
    $('.form_datetime').datetimepicker({
        //language:  'fr',
        weekStart: 1,
        todayBtn:  1,
        autoclose: 1,
        todayHighlight: 1,
        startView: 2,
        forceParse: 0,
        showMeridian: 1
    });
    $('.form_date').datetimepicker({
        language:  'fr',
        weekStart: 1,
        todayBtn:  1,
        autoclose: 1,
        todayHighlight: 1,
        startView: 2,
        minView: 2,
        forceParse: 0
    });
    $('.form_time').datetimepicker({
        language:  'fr',
        weekStart: 1,
        todayBtn:  1,
        autoclose: 1,
        todayHighlight: 1,
        startView: 1,
        minView: 0,
        maxView: 1,
        forceParse: 0
    });
</script>

<Script language="javascript">
function GetQueryString(name)
{
     var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
     var r = window.location.search.substr(1).match(reg);
     if(r!=null)return  unescape(r[2]); return null;
}
function SetRequest(pageNum){
var url=window.location.href;
var s1 = url.split("?")[1];//获取后面参数名值，字符串
if(s1==null){//url不带参数
	window.location.href=url+"?pageNum="+pageNum;
	return;
}
url = url.split("?")[0]+"?";
var s2 = s1.split("&");//获取各个参数名和值字符串 like:   clazzId=1
var patt1=new RegExp("pageNum=");
for(var i=0;i<s2.length;i++){//将pageNum参数去掉
		if(patt1.test(s2[i])==false){
			url = url+s2[i]+"&";
		}
}

window.location.href=url+"pageNum="+pageNum;
}
</Script>

  </body>
</html>